//
//  MessageListTableViewCell.m
//  AILove
//
//  Created by 甘世清 on 2023/12/28.
//

#import "MessageListTableViewCell.h"
#import "HistoryModel.h"
@implementation MessageListTableViewCell

-(void)setModel:(HistoryModel *)model{
    _model = model;
    [self.headerView sd_setImageWithURL:SQURLImage(model.cover)];
    self.nameLabel.text = model.name;
    self.messageLabel.text = model.content;
    self.timeLabel.text = @"";
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)SQ_Style:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    [self.contentView addSubview:self.headerView];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(50);
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(15);
    }];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(73);
        make.top.equalTo(self.contentView).offset(16);
    }];
    
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(73);
        make.top.equalTo(self.contentView).offset(46);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
    }];
    [self.contentView addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.nameLabel);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
    }];
    
    [self.headerView sd_setImageWithURL:SQURLImage(@"http://oversea.nannani.com/2dcff49b9dbd3d7b82d85a340798017d.jpg")];
    self.nameLabel.text = @"名字名字";
    self.messageLabel.text = @"啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊";
    self.timeLabel.text = @"33.44";
}
- (UIImageView *)headerView{
    if (!_headerView) {
        _headerView = [[UIImageView alloc]init];
        _headerView.contentMode = UIViewContentModeScaleAspectFill;
        _headerView.layer.cornerRadius = 25;
        _headerView.layer.masksToBounds = YES;
        _headerView.clipsToBounds = YES;
    }
    return _headerView;
    }

- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_BOLD(18);
        _nameLabel.textColor =  SQColor(@"#FFFFFF");
        _nameLabel.backgroundColor = UIColor.clearColor;
        _nameLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _nameLabel;
}
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_MEDIUM(14);
        _messageLabel.textColor =  SQColor(@"#A4A4A5");
        _messageLabel.backgroundColor = UIColor.clearColor;
    }
    return _messageLabel;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = FONT_MEDIUM(12);
        _timeLabel.textColor =  SQColor(@"#A4A4A5");
        _timeLabel.backgroundColor = UIColor.clearColor;
    }
    return _timeLabel;
}
@end
